char *reverseStr(char *s, int k)
{
    char temp;
    int len = strlen(s);
    int i = 0;
    int j = len / (k * 2);
    int start;
    int end;
    int idx;

    do
    {
        //设置反转起始位置
        start = i * 2 * k;
        end = (start + k) < len ? (start + k) : len;

        for (idx = start; idx < (start + (end - start) / 2); idx++)
        {
            temp = s[idx];
            // 特别需要注意起始和结束的位置 需要加偏移量
            s[idx] = s[end - 1 - idx + start];
            s[end - 1 - idx + start] = temp;
        }
        i++;
    } while (i <= j);

    return s;
}